package com.ruoyi.robot.service;


import jakarta.annotation.Resource;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.ai.ollama.api.OllamaModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/robot")
public class DeepSeekServiceImpl {

    @Autowired
    private DeepSeekClient deepSeekClient;
    @Resource
    private OllamaChatModel ollamaChatModel;
    @Resource
    private AnytingLLMService anytingLLMService;

    @PostMapping("/getAnswer")
    public String getAnswer(@RequestBody String question) {
//        return deepSeekClient.getAnswer(question);
//        String call = ollamaChatModel.call(question);
//        String substring = call.substring(call.lastIndexOf("think>")+6);
        String call = anytingLLMService.askLocalAnythingLLM(question);
        String substring = call.substring(call.lastIndexOf("think>")+6);
        return substring;
    }
}
